package org.hongqi.common.senpec.person.certification;

import com.baomidou.mybatisplus.core.metadata.IPage;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hongqi.common.senpec.base.mybatisplus.IBaseController;
import org.hongqi.common.senpec.base.sevlet.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/person/certifications")
@RequiredArgsConstructor
@Slf4j
public class CertificationController implements IBaseController<Certification> {
    private final CertificationService certificationService;

    @Override
    public Result<Certification> save(Certification entity) {
        return certificationService.mySave(entity);
    }

    @Override
    public Result<?> removeById(Long id) {
        return certificationService.myRemoveById(id);
    }

    @Override
    public Result<Certification> updateById(Certification entity) {
        return certificationService.myUpdateById(entity);
    }

    @Override
    public Result<Certification> getById(Long id) {
        return certificationService.myGetById(id);
    }

    @Override
    public Result<IPage<Certification>> listObjsWithPage(Certification entity) {
        return certificationService.myListObjsWithPage(entity);
    }

    @Override
    public void importObjs(Long creator, MultipartFile file) throws IOException {
        certificationService.myImportObjs(creator, file);
    }


    @Override
    public void exportObjs(HttpServletResponse response) {
        certificationService.myExportObjs(response);
    }
}
